package com.wangjie.binarysearch;

/**
 * @author jieshao
 * @date 2022/4/15 16:15
 */
public class Test01 {
    public static void main(String[] args) {
        int[] arr = {1, 2, 2, 2, 3};
        BinarySearch bs = new BinarySearch();
        int res1 = bs.binarySearch(arr, 2);
        int res2 = bs.left_bound(arr, 2);
        int res3 = bs.right_bound(arr, 2);

        int res4 = bs.left_bound(arr, 10);
        int res5 = bs.left_bound(arr, 0);

        int res6 = bs.right_bound(arr, 10);
        int res7 = bs.right_bound(arr, 0);

        System.out.println("res1:" + res1);
        System.out.println("res2:" + res2);
        System.out.println("res3:" + res3);
        System.out.println("--------------------");
        System.out.println("res4:" + res4);
        System.out.println("res5:" + res5);
        System.out.println("--------------------");
        System.out.println("res6:" + res6);
        System.out.println("res7:" + res7);
    }
}